package com.googlecode.androidutils.database;

import android.database.sqlite.SQLiteDatabase;

/**
 * Interface for callback objects that perform actions using a managed
 * {@link SQLiteDatabase database}.
 * 
 * @author Alexander Metzner
 * 
 * @param <T>
 *            the type of return value
 * @see SQLiteDatabaseTemplate
 */
public interface DatabaseCallback<T> {
	/**
	 * Callback method to perform the desired action. The given database has
	 * been acquired before and will be closed after the callback finishes.
	 * 
	 * @param database
	 *            the database to work on
	 * @return the result of the operation
	 */
	T doWithDatabase(final SQLiteDatabase database);
}